<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1.0"/>
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <title><{$cfg_homepage_title}></title>
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/Js/confirm/confirm.css">
    <style>

    </style>
    <style type="text/css">
        html, body, canvas {
            margin: 0px;
            padding: 0px;
            border: none;
            text-align: center;
            background-color: black;
        }
        body{
            width:100vw;height:100vh;overflow: scroll;
        }
        canvas {
            background-color: white;
        }

        .divClass2 {
            text-decoration: underline;
        }
    </style>


    <style>
        body {
            margin: 0;
            padding: 0;
            background-color: #000;
            overflow: hidden;
            height: 100vh;
            width: 100vw;
        }

        #redpack {
            position: relative;
            height: 0;
            width: 100%;
            overflow: hidden;
        }

        .bg {
            max-width: 100%;
            display: block;
            top: 0;
            left: 0;
        }

        .redpack-layer {
            position: absolute;
            top: 0;
            left: 0;
            width: 100vw;
            height: 100vh;
            background-color: rgb(66, 66, 66);
            z-index: 10;
        }

        .redpack-layer .redpack {
            width: 80%;
            position: relative;
            left: 50%;
            margin-left: -40%;
            top: 0;
        }

        .redpack img {
            max-width: 100%;
            display: block;
        }

        .redpack .btn-open {
            width: 25%;
            left: 50%;
            margin-left: -12.5%;
            position: absolute;
            bottom: 12%;
        }

        .redpack .app-avatar {
            border-radius: 50%;
            display: block;
            width: 13vw;
            height: 13vw;
            position: absolute;
            bottom: 44%;
            left: 50%;
            margin-left: -6.5%;
        }

        .redpack .app-name {
            position: absolute;
            bottom: 39%;
            text-align: center;
            color: #fff6b9;
            box-sizing: border-box;
            width: 50vw;
            left: 50%;
            margin-left: -25vw;
        }

        .redpack .text {
            color: #FFF;
            position: absolute;
            bottom: 5%;
            text-align: center;
            width: 50vw;
            left: 50%;
            margin-left: -25vw;
        }

        .redpack .btn-close {
            width: 7vw;
            height: 7vw;
            position: absolute;
            bottom: -9%;
            left: 50%;
            margin-left: -3.5vw;
        }

        .redpack-detail {
            position: relative;
            width: 100%;
            /*height:100vh;*/
            background-color: #000;
        }

        .redpack-detail .btn-confirm {
            position: absolute;
            top: 48%;
            width: 80%;
            left: 50%;
            margin-left: -40%;
        }

        .redpack-detail .app-avatar {
            position: absolute;
            top: 12%;
            width: 16vw;
            height: 16vw;
            left: 50%;
            margin-left: -8vw;
        }

        .redpack-detail .app-name {
            position: absolute;
            top: 22%;
            width: 80%;
            text-align: center;
            left: 50%;
            margin-left: -40%;
            color: #666666;
            box-sizing: border-box;
        }

        .redpack-detail .text-box {
            background-color: #fff3ee;
            padding: 10px;
            border-radius: 10px;
            text-align: center;
            position: absolute;
            width: 75%;
            left: 50%;
            margin-left: -37.5%;
            color: #000;
            top: 30%;
            box-sizing: border-box;
            padding-top: 20px;
            padding-bottom: 20px;
        }

        .redpack-detail .text-box .amount {
            font-size: 2em;
            color: #ffca31;
        }

        .redpack-detail .text-box .text {
            font-size: .8em;
            color: #c6c4c3;
        }
        .pop,.pop_load{
           position: fixed;
           top:0;left:0;z-index:100;width:100vw;height: 100vh;
            background: rgba(0,0,0,.3);
        }
        .pop_load{z-index:120;background: rgba(0,0,0,.3)}
        .pop_content{
            position: absolute;
            top:50%;left:50%;
            transform: translate(-50%,-50%);
            background: #fff;border-radius: 4px;
            width:60%;height:100px;
        }
        .icon_load{
            position: absolute;
            top:50%;left:50%;
            transform: translate(-50%,-50%);
            width:50px;height: 50px;
        }
        .pop_title{
            color:#008278;
            font-size:20px;
            text-align: center;
            padding:0 0 20px 0;
        }
        .pop_content .icon_close{
            text-align: right;font-size:24px;padding-right:10px;
            color:#cdcdcd;
        }
        .pop_content .btn_box{
            display: flex;
        }
        .pop_content .btn_box>div{
            flex:1;border:1px solid #008278;height:40px;line-height: 40px;
        }
        .hide{display: none;}
        .pop_content .btn_box>div:first-child{background:#FFF;color:#008278; border-radius: 0 0 0 4px ;}
        .pop_content .btn_box>div:last-child{background:#008278;color:#fff; border-radius: 0 0 4px 0;}
        [v-cloak]{display: none;}
        /*点击加载*/
        *{padding:0;margin:0;box-sizing: border-box;}
        .bg_body{width:100vw;height: 100vh;position: fixed;top:0;left:0;z-index:1000;}
        .bg_img{width:100vw;height:100vh;}
        .bg_body .btn{
            position: absolute;
            width:30%;
            height:5vh;
            background: transparent;
            top:76%;
            left:50%;transform: translateX(-50%);
            z-index:10;
        }
        @keyframes move {
            0%{transform: translateY(0);}
            50%{transform: translateY(-10px);}
            100%{transform: translateY(0);}
        }
        .move_box{
            position: fixed;z-index:100;
            top:50%;left:0;width:100%;text-align: center;
        }
        .move_box .move_txt{color:#9BB1A4;margin-bottom:40px;}
        .move_box .move_icon{
            width:40px;
            animation: move 1s linear infinite;
        }
    </style>

</head>
<body>
<canvas id="stage">
    您的浏览器不支持html5, 请换用支持html5的浏览器。
</canvas>
<!--数钱弹窗-->
<div class="pop hide" style="z-index:110;">
    <div class="pop_content">
        <div class="icon_close">&times;</div>
        <div class="pop_title">
            是否开始数钱？
        </div>
        <div class="btn_box">
            <div>否</div>
            <div id="confirm_btn">是</div>
        </div>
    </div>
</div>
<!--end of 数钱弹窗-->
<!--加载弹窗-->
<div class="pop_load" id="pop_load">
    <img src="__PUBLIC__/Images/loading.gif" class="icon_load" alt="">
</div>
<!--加载弹窗-->
<div id="redpack" v-cloak>
    <div v-if="showPage" style="position:fixed;top:0;left:0;width:100vw;height:100vh;overflow: hidden;">
        <div style="position:relative;">
            <div class="redpack-detail" v-if="showRedpack">
                <img class="bg" src="__PUBLIC__/Redpack/redpack-bg.png">
                <img class="app-avatar" v-bind:src="appAvatar">
                <span class="app-name">{{appName}}</span>

                <div class="text-box">
                    <div class="amount">¥ {{bill_amount}}</div>
                    <div class="text">红包已存入微信零钱，可直接使用</div>
                </div>

                <img class="btn-confirm" @click="confirm" src="__PUBLIC__/Redpack/button.png">
            </div>

            <div class="redpack-layer" v-if="showCover">
                <div class="redpack">
                    <img src="__PUBLIC__/Redpack/redpack.png">
                    <img class="btn-open" @click="open" src="__PUBLIC__/Redpack/btn_open.png">
                    <img class="app-avatar" style="border-radius: 0;" :src="appAvatar">

                    <span class="app-name" style="margin-top:5px;">{{appName}}</span>
                    <span class="text">红包可立即提现</span>

                    <img @click="hideCover" src="__PUBLIC__/Redpack/btn_close.png" class="btn-close">
                </div>
            </div>
        </div>
    </div>
</div>

<div class="bg_body">
    <img src="__PUBLIC__/Images/index_01.jpg" alt="" class="bg_img" id="bg_img">
    <div class="btn" id="btn"></div>
</div>
<div class="move_box hide">
     <p class="move_txt">上滑开始数钱</p>
    <img src="__PUBLIC__/Images/arrow_g.png" class="move_icon" alt="">
</div>


<script type="text/javascript">
    var GID = "shuqian";
    var SCORE_LIMIT = 10000;
    var APP_LIST_URL = '';
    var need_login = "<{$need_login}>";
    var TIME_LIMIT = "<{$time_limit}>";
    var PASS_SCORE = "<{$pass_score}>";

</script>

<script type="text/javascript" src="__PUBLIC__/Js/jquery-3.4.1.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/Js/jquery.cookie.js"></script>
<script type="text/javascript" src="__PUBLIC__/Js/createjs-2013.12.12.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/Js/qipa_app.js?v=2019ww"></script>
<script type="text/javascript" src="__PUBLIC__/Js/qipa_stage.js?v=201990"></script>
<script type="text/javascript" src="__PUBLIC__/Js/main1.js?v=14.8"></script>
<script type="text/javascript" src="__PUBLIC__/Redpack/vue.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/Js/confirm/jquery-confirm.js"></script>
<!-- <script type='text/javascript' src='/demo_shuqian/Public/Js/main.js?"+Math.random();+"'></script> -->
<script>
    $("#redpack").hide();
    setTimeout(function () {
        $("#redpack").show()
    }, 1000);
    $().ready(function () {
        $("#confirm_btn").on("click",function (e) {
            e.stopPropagation()
            $(".pop").addClass("hide");
        });
        var  IW =parseInt($(".bg_body").css("width")),
            IH = parseInt($(".bg_body").css("height"));
        console.log("IW",IW,"IH",IH);
        if(IH/IW>=1.70){
            $("#bg_img").attr("src","/Public/Images/count/index_big.jpg");
            $("#btn").css("top","65%");
        }
        $("#btn").on("click",function () {
            if(loading){
                $(".bg_body").addClass("hide")
            }else{
               $("#pop_load").removeClass("hide");
                $(".bg_body").addClass("hide");
            }
        })
    })
</script>
<script>
    var RedPack = new Vue({
        el: "#redpack",
        data: {
            billId: "{$billId}",
            bill: {},
            bill_amount: 0,
            appName: "西双版纳 榕城时光",
            appAvatar: "__PUBLIC__/Images/avatar.png",
            showCover: false,
            showRedpack: false,
            showPage: false,
            score: 0
        },
        methods: {
            getNewRedPack: function () {
                this.showCover = true;
                this.showPage = true;
            },
            open: function () {
                this.showCover = false;
                this.showRedpack = true;
                this.showPage = true;

                $.ajax({
                    type: "post",
                    url: "/index.php/Index/doLuck",
                    data: {bill_id: this.billId},
                    dataType: "json",
                    success: function (res) {
                        if (res.code == 200) {
                            this.bill = res.data;

                        } else {
                            alert(res.msg);
                        }
                        if (res.code == 201) {
                            this.bill = res.data;
                            alert('您已领过红包啦，分享给其他小伙伴试试吧');
                        }
                    }
                });
            },
            hideCover: function () {
                this.showCover = false;
                this.showPage = false;
                $("#redpack").hide();
                setTimeout(function () {
                    $("#redpack").show();
                }, 1000)
            },
            setBillId: function (billId) {
                this.billId = billId
            },
            setBill: function (billData) {
                this.bill_amount = billData.amount;
                this.bill = billData;
            },
            setScore: function (score) {
                this.score = score;
            },
            confirm: function () {
//                confirm("哇噻!" + TIME_LIMIT + "秒你数了" + this.score + "元！赶快通知一下小伙伴吧!");

                this.showRedpack = false;
                this.showPage = false;
                this.showCover = false;
//                $("#redpack").hide();
//                setTimeout(function () {
//                    $("#redpack").show();
//                }, 1000)
            }
        },
        created: function () {

        }
    })
</script>

<script language=javascript>

    var shareData = new Array();
    getshareData();

    function getshareData() {


    }

    var mebtnopenurl = location.href;
    window.shareData = {

        "timeLineLink": location.href,
        "tTitle": "数钱数到手抽筋-微资源游戏",
        "tContent": "数钱数到手抽筋-微资源游戏"
    };

    function goHome() {
        window.location = mebtnopenurl;
    }

    function clickMore() {
        if ((window.location + "").indexOf("zf", 1) > 0) {

        }
        else {
            goHome();
        }
    }

    function dp_share() {
        document.title = "我" + TIME_LIMIT + "秒内数了" + myData.score + "元钞票，手都快抽筋，你也来试试看！";
        document.getElementById("share").style.display = "";
        window.shareData.tTitle = document.title;
    }

    function dp_Ranking() {
        window.location = mebtnopenurl;
    }

    function showAd() {
    }

    function hideAd() {
    }


</script>
<div id="share" style="display: none">

</div><!--SDK JS -->
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<div style="display: none;"></div>
<script type="text/javascript">
    var myData = {gameid: "sqsdscj"};

    function confirmRedPack(message) {
        $.confirm({
            title: '提示！',
            content: message,
            buttons: {
                ok: {
                    text: "确认领取",
                    btnClass: 'btn-primary',
                    keys: ['enter'],
                    action: function(){
//                            alert("你点击了确认按钮！")
                    }
                },
                cancel: {
                    text: "取消",
                    btnClass: 'btn-primary',
                    keys: ['esc'],
                    action:function () {
//                            alert("你点击了取消按钮！")
                    }
                }
            }
        });
    }

    function dp_submitScore(score) {
        console.log("请求")
        if (score > 0) {
            RedPack.setScore(score);
        }
       // alert(score+"is_need "+ need_login);
        //更新成绩
        if (need_login == '0' && score != 0) {
            $.ajax({
                cache: true,
                type: "post",
                url: '__APP__/Index/doInput',
                dataType: 'json',
                data: {score: score},
                async: false,
                error: function (data, msg) {
                    alert('发送失败，刷新重试');
                },
                success: function (data) {
                    //alert(data);
                    //alert(score);
                    // self.location.href='__APP__/Index/showList';
                    myData.score = score;
                    myData.scoreName = "数了" + score + "元";
                    if (score > 0) {
                   //alert('line 1117');
                        if (confirm("哇噻!" + TIME_LIMIT + "秒你数了" + score + "元！赶快通知一下小伙伴吧!")) {
                            dp_share();
                        } else {
                            //alert('hehe ');
                        }
                    }
                }
            });

        } else {
            myData.score = score;
            myData.scoreName = "数了" + score + "元";
            if (score > 0) {
                if (score > parseInt(PASS_SCORE)) {
                    $.ajax({
                        type: "post",
                        url: "/index.php/Index/saveScore",
                        data: {score: score},
                        dataType: "json",
                        success: function (res) {
                            if (res.code == 200) {
                                if (res.bill_id > 0) {
                                    RedPack.setBillId(res.bill_id);
                                    RedPack.setBill(res.data);
                                    $.confirm({
                                        title: '提示！',
                                        content: "哇噻!" + TIME_LIMIT + "秒你数了" + score + "元！通关成功，获得一个随机金额红包!",
                                        buttons: {
                                            ok: {
                                                text: "确认领取",
                                                btnClass: 'btn-primary',
                                                keys: ['enter'],
                                                action: function(){
                                                    RedPack.getNewRedPack();
                                                }
                                            },
                                            cancel: {
                                                text: "取消",
                                                btnClass: 'btn-primary',
                                                keys: ['esc'],
                                                action:function () {

                                                }
                                            }
                                        }
                                    });
                                }
                            } else {
                                alert(res.msg);
                            }
                        }
                    });
                    dp_share();
                } else {
                    if (confirm("哇噻!" + TIME_LIMIT + "秒你数了" + score + "元！当前成绩没有通关，赶快邀请小伙伴来战!")) {
                        dp_share();
                    }
                }
            }
        }

    }

    function onShareComplete(res) {
        if (localStorage.myuid && myData.score != undefined) {
            setTimeout(function () {
                if (confirm("要将成绩提交到微资源游戏排行榜吗？")) {

                }
                else {
                    document.location.href = location.href;
                }
            }, 500);
        }
        else {
            document.location.href = location.href;
        }
    }



</script>
<script>

    wx.config({
        debug: false,
        appId: '<{$signPackage["appId"]}>',
        timestamp: '<{$signPackage["timestamp"]}>',
        nonceStr: '<{$signPackage["nonceStr"]}>',
        //nonceStr: '<{$signPackage["timestamp"]}>',
        signature: '<{$signPackage["signature"]}>',
        //signature:'72114fafe22bfeac6bdcc4e615c19b8c',
        jsApiList: [
            'onMenuShareTimeline',
            'onMenuShareAppMessage',
            'hideMenuItems'//隐藏分享按钮
        ]
    });

    wx.ready(function () {
// 在这里调用 API

        shareFn();


    });

    wx.error(function (res) {

        alert(res.errMsg);
    });

    function shareFn() {
        //隐藏分享按钮函数
        wx.hideMenuItems({
            menuList: [
                'menuItem:copyUrl',
                'menuItem:openWithQQBrowser',
                'menuItem:share:email',
                'menuItem:openWithSafari'
            ],
            success: function (res) {
            },
            fail: function (res) {
            }
        });
        wx.onMenuShareAppMessage({
            title: '<{$cfg_wx_share_title}>',
            desc: '<{$cfg_wx_share_desc}>',
            link: 'http://money.newzow.com/index.php/Index/index1.html',
            imgUrl: '<{$cfg_wx_share_pic}>',
            trigger: function (res) {
                //alert('用户点击发送给朋友');
            },
            success: function (res) {
                //alert('已分享成功');

            },
            cancel: function (res) {
                //alert('已取消');
            },
            fail: function (res) {
                // alert(JSON.stringify(res));
            }
        });

        wx.onMenuShareTimeline({
            title: '<{$cfg_wx_share_desc}>',
            //link: '<{$cfg_wx_share_url}>',
            link:'http://money.newzow.com/index.php/Index/index1.html',
            imgUrl: '<{$cfg_wx_share_pic}>',

            trigger: function (res) {
                // alert('用户点击分享到朋友圈');
            },
            success: function (res) {
                //alert('已分享成功');

            },
            cancel: function (res) {
                //alert('已取消分享');
            },
            fail: function (res) {
                //alert(JSON.stringify(res));
            }
        });

    }


</script>

</body>
</html>